Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix opacity adjustment and set it to low non-zero value #280

Merged
merged 2 commits into from
Jan 15, 2024

Conversation

zoccoler
Copy link
Collaborator

@zoccoler zoccoler commented Dec 6, 2023

This should fix #279 and could potentially solve #271 .

This lets the selected layer barely visible (opacity = 0.2), which would not lead (I think) to the user thinking the original labels layer was broken, but still hide it quite a bit so that the clustering result does not blend much with the labels colors.

The best option in my opinion is to interactively hide and show it, which is already written in the documentation under Manual clustering.

Diving deep into git blame, it seems this was set by @thorstenwagner here, which then was later updated to setting opacity to 0. @thorstenwagner, would it be OK for your use cases to let a small opacity like 0.2?

Best,
Marcelo

@zoccoler
Copy link
Collaborator Author

zoccoler commented Dec 6, 2023

The changes are minimal, I added both @stefanhahmann and @thorstenwagner as reviewers because you are somehow involved in the issues.

Let me know if you agree with the changes.

Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (2b47b7f) 76.52% compared to head (d74d308) 76.52%.

Files Patch % Lines
napari_clusters_plotter/_plotter.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #280   +/-   ##
=======================================
  Coverage   76.52%   76.52%           
=======================================
  Files          16       16           
  Lines        1853     1853           
=======================================
  Hits         1418     1418           
  Misses        435      435           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zoccoler zoccoler added this to the 0.7.4 milestone Dec 6, 2023
@Cryaaa
Copy link
Collaborator

Cryaaa commented Dec 7, 2023

I would generally agree to the changes but it would be good to hear from the others! Apart from that feel free to merge

Copy link
Contributor

@stefanhahmann stefanhahmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR is a good idea. I would even increase the opacity to 0.25 or 0.3, but this is subjective.
In my view, this would solve #271 indeed. In fact, this PR implements one of the described solutions of #271.

@@ -124,7 +124,7 @@ def manual_clustering_method(inside):
plot_cluster_name=clustering_ID,
)
if isinstance(self.analysed_layer, Labels):
self.layer_select.value.opacity = 0
self.layer_select.opacity = 0.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested a bit. I would prefer 0.25 or even 0.3

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to not increase it too much so maybe we can stick to 0.25, so that the experience does not change too dramatically?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.25 would be fine for. (I could also live with 0.2). The slight increase was just a subjective suggestion.

@Cryaaa
Copy link
Collaborator

Cryaaa commented Dec 11, 2023

@zoccoler,
I have one question before merging: does the visbility actually change the speed of the plugin? I could imagine that by making the layer visible napari would need some more time to render the image or is this not the case? Unfortunately I do not have much time for testing this week but will reply once I have had the chance to.

@stefanhahmann
Copy link
Contributor

@Cryaaa I could imagine that by making the layer visible napari would need some more time to render the image or is this not the case?

I just tested this a bit on my machine and it did not seem to make a difference, even though I would agree, that one might expect a difference.

@Cryaaa
Copy link
Collaborator

Cryaaa commented Dec 11, 2023

@Cryaaa I could imagine that by making the layer visible napari would need some more time to render the image or is this not the case?

I just tested this a bit on my machine and it did not seem to make a difference, even though I would agree, that one might expect a difference.

Thanks for checking this so soon! I am fine with merging this from my end maybe @thorstenwagner can chime in over the next few days if he is also fine with this? otherwise I'll merge it.

@thorstenwagner
Copy link
Collaborator

I totally forgot to check that. Will do it today.

@thorstenwagner
Copy link
Collaborator

thorstenwagner commented Jan 15, 2024

Hi, from my side everything still works as it should be. Probably because I set the opacity to zero when I load the the plugin:
https://github.com/MPI-Dortmund/napari-tomotwin/blob/main/src/napari_tomotwin/load_umap.py#L79

@Cryaaa
Copy link
Collaborator

Cryaaa commented Jan 15, 2024

Perfect! Then I'll merge this fixing #279

@Cryaaa Cryaaa merged commit eca8459 into main Jan 15, 2024
8 checks passed
@Cryaaa Cryaaa deleted the fix_opacity_runtime_error branch January 23, 2024 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RuntimeError when manually selecting cluster (still works though)
4 participants